// import Vue from 'vue'
// import VueRouter from 'vue-router'
// import Home from '../views/Home.vue'

// Vue.use(VueRouter)

// const routes = [
//   {
//     path: '/',
//     name: 'Home',
//     component: Home
//   },
//   {
//     path: '/about',
//     name: 'About',
//     // route level code-splitting
//     // this generates a separate chunk (about.[hash].js) for this route
//     // which is lazy-loaded when the route is visited.
//     component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
//   }
// ]

// const router = new VueRouter({
//   mode: 'history',
//   base: process.env.BASE_URL,
//   routes
// })

// export default router




import Vue from "vue"
import VueRouter from "vue-router"

Vue.use(VueRouter)
import {menus} from "@/utils/menus"
const routes = [
    { path: "/", redirect: "/login" },   //重定向
    // component: () => import("@/views/Login.vue")  路由懒加载   需要这个组件才去加载这个组件
    { path: "/login", name: "login", component: () => import("@/views/Login.vue") },
    { 
        path: "/index", 
        name: "index", 
        component: () => import("@/views/Index.vue"),
        redirect:"/index/home",
        children:[
            ...menus
        ]
     },
    { path: "404", name: "notFound", component: () => import("@/views/404.vue") },
    { path: "*", redirect: { name: 'notFound' } },
]


const router = new VueRouter({
    routes,
    mode: "hash",
    base: ""
})

export default router;
